home *** CD-ROM | disk | FTP | other *** search
/ IRIX Development Foundation for IRIX 6.4 / SGI IRIX 6.4 Development Foundation.iso / dist / dist6.4 / c++_dev.idb / usr / include / dem.h.z / dem.h
Encoding:
C/C++ Source or Header  |  1997-09-11  |  2.9 KB  |  110 lines

  1. #ifndef __DEM_H__
  2. #define __DEM_H__
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6.  
  7. /*ident    "@(#)cls4:tools/demangler/dem.h    1.3" */
  8.  
  9. typedef struct DEMARG DEMARG;
  10. typedef struct DEMCL DEMCL;
  11. typedef struct DEM DEM;
  12.  
  13. enum DEM_TYPE {
  14.     DEM_NONE,        /* placeholder */
  15.     DEM_STI,        /* static construction function */
  16.     DEM_STD,        /* static destruction function */
  17.     DEM_VTBL,        /* virtual table */
  18.     DEM_PTBL,        /* ptbl vector */
  19.     DEM_FUNC,        /* function */
  20.     DEM_MFUNC,        /* member function */
  21.     DEM_SMFUNC,        /* static member function */
  22.     DEM_CMFUNC,        /* const member function */
  23.     DEM_OMFUNC,        /* conversion operator member function */
  24.     DEM_CTOR,        /* constructor */
  25.     DEM_DTOR,        /* destructor */
  26.     DEM_DATA,        /* data */
  27.     DEM_MDATA,        /* member data */
  28.     DEM_LOCAL,        /* local variable */
  29.     DEM_CTYPE,        /* class type */
  30.     DEM_TTYPE        /* template class type */
  31. };
  32.  
  33. struct DEMARG {
  34.     char* mods;        /* modifiers and declarators (page 123 in */
  35.                 /* ARM), e.g. "CP" */
  36.  
  37.     long* arr;        /* dimension if mod[i] == 'A' else NULL */
  38.  
  39.     DEMARG* func;        /* list of arguments if base == 'F' */
  40.                 /* else NULL */
  41.  
  42.     DEMARG* ret;        /* return type if base == 'F' else NULL */
  43.  
  44.     DEMCL* clname;        /* class/enum name if base == "C" */
  45.  
  46.     DEMCL** mname;        /* class name if mod[i] == "M" */
  47.                 /* in argument list (pointers to members) */
  48.  
  49.     DEMARG* next;        /* next argument or NULL */
  50.  
  51.     char* lit;        /* literal value for PT arguments */
  52.                 /* e.g. "59" in A<59> */
  53.  
  54.     char base;        /* base type of argument, */
  55.                 /* 'C' for class/enum types */
  56. };
  57.  
  58. struct DEMCL {
  59.     char* name;        /* name of class or enum without PT args */
  60.                 /* e.g. "Vector" */
  61.  
  62.     DEMARG* clargs;        /* arguments to class, NULL if not PT */
  63.  
  64.     char* rname;        /* raw class name with __pt__ if PT */
  65.                 /* e.g. "A__pt__2_i" */
  66.  
  67.     DEMCL* next;        /* next class name, NULL if not nested */
  68. };
  69.  
  70. struct DEM {
  71.     char* f;        /* function or data name;  NULL if type name */
  72.                 /* see page 125 of ARM for predefined list */
  73.  
  74.     char* vtname;        /* if != NULL name of source file for vtbl */
  75.  
  76.     DEMARG* fargs;        /* arguments of function name if __opargs__ */
  77.                 /* else NULL */
  78.  
  79.     DEMCL* cl;        /* name of relevant class or enum or NULL */
  80.                 /* used also for type-name-only input */
  81.  
  82.     DEMARG* args;        /* args to function, NULL if data or type */
  83.  
  84.     enum DEM_TYPE type;    /* type of name that was demangled */
  85.  
  86.     short slev;        /* scope level for local variables or -1 */
  87.  
  88.     char sc;        /* storage class type 'S' or 'C' or: */
  89.                 /* i -> __sti   d --> __std */
  90.                 /* b -> __ptbl_vec */
  91. };
  92.  
  93. #define MAXDBUF 32768        /* size of buffer used by dem() for memory
  94.                    management. */
  95.  
  96. int  demangle(const char *in, char *out);
  97. int  dem(char *s, DEM *p, char *buf);
  98. int  dem_print(DEM *p, char *buf);
  99. void dem_printarg(DEMARG *p, char *buf, int f);
  100. void dem_printarglist(DEMARG *p, char *buf, int sv);
  101. void dem_printfunc(DEM *dp, char *buf);
  102. void dem_printcl(DEMCL *p, char *buf);
  103. char* dem_explain(enum DEM_TYPE t);
  104.  
  105. #ifdef __cplusplus
  106. }
  107. #endif /* __cplusplus */
  108.  
  109. #endif /* __DEM_H__ */
  110.